<script>
init({
  title: 'Table Sortable',
  desc: 'Use `sortable` option to set the basic sort, the default value is `true`. We can set `false` to disable `sortable` of all columns.',
  links: ['bootstrap-table.min.css'],
  scripts: ['bootstrap-table.min.js']
})
</script>

<template>
  <div class="toolbar">
    <label>
      <input
        id="sortable"
        type="checkbox"
      > sortable
    </label>
  </div>

  <table
    id="table"
    data-toggle="table"
    data-toolbar=".toolbar"
    data-sortable="false"
    data-height="460"
    data-url="json/data1.json"
  >
    <thead>
      <tr>
        <th
          data-field="state"
          data-checkbox="true"
        >
          ID
        </th>
        <th
          data-field="id"
          data-sortable="true"
        >
          ID
        </th>
        <th
          data-field="name"
          data-sortable="true"
        >
          Item Name
        </th>
        <th
          data-field="price"
          data-sortable="true"
        >
          Item Price
        </th>
      </tr>
    </thead>
  </table>
</template>

<script>
  function mounted () {
    $('#sortable').change(function () {
      $('#table').bootstrapTable('refreshOptions', {
        sortable: $('#sortable').prop('checked')
      })
    })
  }
</script>
